#coding=utf-8
__author__ = 'aesop'

import urllib2
import json
import urllib

class http_request_ssl:
    __uri = ""
    def __init__(self, uri):
        self.__uri = uri

    def do_get(self):
        f = urllib2.urlopen(self.__uri)
        buf = f.read()
        f.close()
        return buf
#data 应该是个字典
    def do_post(self, values):
        data = urllib.urlencode(values)
        req = urllib2.Request(self.__uri, data)
        f = urllib2.urlopen(req)
        return f.read()
    def do_post_json(self, json_data):
        req = urllib2.Request(self.__uri, json_data)
        f = urllib2.urlopen(req)
        return f.read()